//
//  NetWorkingTool.m
//  豆瓣电影1
//
//  Created by dllo on 15/4/9.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "NetWorkingTool.h"

@implementation NetWorkingTool
+ (void)netWorkingToolStr:(NSString *)strURL block:(Block)myBlock
{
    NSString *strURLEncode = [strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url = [NSURL URLWithString:strURLEncode];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        id result = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
        myBlock(result);
        
        
    }];
}
@end
